﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Abs.Core;

namespace Abs.App.Admin
{
    public partial class Delete_Room : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Role"] == null)
            {
                Response.Redirect("~/User/Unauthorized_Access.aspx");
            }

            if (((int)Session["Role"] != (int)Abs.Core.Models.User.RoleEnum.Admin))
            {
                Response.Redirect("~/User/Unauthorized_Access.aspx");
            }

            var roomManager = Abs.Core.Management.Manage.Room;
            if (roomManager.DeleteRoom(int.Parse(Request.QueryString["Id"])))
            {
                Response.Redirect("~/Admin/Manage_Rooms.aspx");
            }
            else
            {
                Response.Redirect("~/Default.aspx");
            }
        }
    }
}